package com.nsu.evaluation.controller;

import com.nsu.evaluation.common.Const;
import com.nsu.evaluation.pojo.AdminUsers;
import com.nsu.evaluation.service.impl.ScoreServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@Controller
@RequestMapping(value = "/api/teacher/")
public class TeacherUserController {

    @Autowired
    private ScoreServiceImpl scoreServiceImpl;

    /**
     * 跳转到教师用户首页
     * @param request
     * @param session
     * @return
     */
    @RequestMapping(value = "toTeacherIndex")
    public ModelAndView toTeacherInder(HttpServletRequest request, HttpSession session){
        ModelAndView modelAndView = new ModelAndView("/WEB-INF/page/teacher/teacherindex.jsp");
        AdminUsers adminUsers = (AdminUsers)session.getAttribute(Const.CURRENT_USER);
        modelAndView.addObject("userdata",adminUsers);
        modelAndView.addObject("userrole",session.getAttribute(Const.CURRENT_USER_ROLE));
        return modelAndView;
    }


}
